package org.ioc.com.book7.enums;

public enum BookStatus {
    DELETE(0,"删除"),
    NORMAL(1,"可借阅"),
    FORBIDDEN(2,"不可借阅"),
    ;

    public static String getByCode(Integer code){
        BookStatus[] values = BookStatus.values();
        for (BookStatus bookStatus:values){
            if (code== bookStatus.code){
                return bookStatus.getDesc();
            }
        }
        return "";
    }


    BookStatus(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    private Integer code;
    private String desc;

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }
}
